import axios from './axios';
import baseConfig from './baseConfig'
//  公用部分api
//var NODE_ENV = process.env.NODE_ENV;
//var baseurl = NODE_ENV == 'development' ? 'http://192.168.0.206:9028/trade' : '../trade';

var apiUrl = baseConfig.apiUrl;
var api = {};
api.getSignPack = apiUrl + '/wechat/setting/signPackage'; //获取openid
api.getSignPack = apiUrl + '/wechat/setting/signPackage'; //获取签名包
api.getCompanyList = apiUrl + '/wechat/setting/getCompanyList'; //获取公司列表
api.getBaseInfo = apiUrl + '/wechat/setting/getBaseInfo'; //获取基本信息
api.bindOpenId = apiUrl + "/" //绑定
api.bindOpenId = apiUrl + "/" //报表信息
api.getCode = apiUrl + '/message/send'; //发送验证码
api.bind = apiUrl + '/message/valid'; //openid和手机号绑定
api.getInfo = apiUrl + '/company/bind'; //openid和手机号绑定
api.reportDetail = apiUrl + '/report';//报表详情

export default {
    getSignPack(currentUrl) {
        return axios.get(api.getSignPack, {
            params: {
                url: currentUrl
            }
        })
    },
    getCompanyList() {
        return axios.get(api.getCompanyList)
    },
    getBaseInfo() {
        return axios.get(api.getBaseInfo)
    },
    getCode(mobile) {
        return axios.post(api.getCode, {
            mobile: mobile
        })
    },
    bind(obj) {
        return axios.post(api.bind, {
            mobile: obj.mobile,
            code: obj.code,
            openid: obj.openid
        })
    },
    getInfo() {
        return axios.post(api.getInfo)
    },
    reportDetail(companyCode,userCode){
        return axios.get(api.reportDetail,{
            params:{
                companyCode,
                userCode
            }
        })
    }
}